<?php
namespace Textblast;

class Validate {

	static function isEmail($email) {
		return preg_match('/\b[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,4}\b/', $email);
	}
	static function isNumber($num) {
		return preg_match('/\b[1-9]0+/', $num);;
	}
	static function isNumberZ($num) {
		return preg_match('/\b[0-9]+/', $num);;
	}
	static function isAlphaNumeric($alphaNum) {
		return preg_match('/\b[a-zA-Z0-9]+\b/', $alphaNum);	
	}
	static function isUsername($uname) {
		return preg_match('/[a-zA-Z]+([a-zA-Z0-9])*/', $uname);	
	}
	static function makeHash($str) {
		return hash('sha256', $str);
	}
	static function withDomain($str) {
		return preg_match('/\b[a-zA-Z0-9]+\\\\\\\\[a-zA-Z0-9]+$/', $str);
	}
	static function isRequired($str) {
		return (strlen(trim($str)) === 0);
	}
}

?>